﻿using System;

namespace ConsoleApp4
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = new int[10];
            int max, min, i;
            int sum = 0;
            double ave;
            Random ran = new Random();
            Console.WriteLine("生成的随机数组如下：");
            for (i = 0; i < 10; i++)
            {
                a[i] = ran.Next(100);
                Console.Write(a[i] + " ");
            }
            Console.WriteLine();
            max = min = a[0];
            for (i = 1; i < 10; i++)
            {
                if (max < a[i])
                    max = a[i];
                if (min > a[i])
                    min = a[i];
                sum = sum + a[i];
            }
            ave = sum / 10;
            Console.WriteLine("最大值，最小值，平均值分别如下：");
            Console.WriteLine(max);
            Console.WriteLine(min);
            Console.WriteLine(ave);
            Console.ReadKey();
        }
    }
}
